export let categoryJson = [
	{"item_code":"01","item_name":"一类维修经营业务"},
	{"item_code":"02","item_name":"二类维修经营业务"},
	{"item_code":"03","item_name":"三类维修经营业务"},
	{"item_code":"04","item_name":"其他机动车维修"},
	{"item_code":"99","item_name":"其他"}
]

export let businessScopeJson = [
	[
		{"item_code":"06","item_name":"大型货车维修"},
		{"item_code":"01","item_name":"大中型客车维修"},
		{"item_code":"04","item_name":"危险货物运输车辆维修"},
		{"item_code":"05","item_name":"维修救援"},
		{"item_code":"03","item_name":"小型车辆维修"}
	],
	[
		{"item_code":"01","item_name":"大中型货车维修"},
		{"item_code":"05","item_name":"大型货车维修"},
		{"item_code":"02","item_name":"大中型客车维修"},
		{"item_code":"04","item_name":"维修救援"},
		{"item_code":"03","item_name":"小型车辆维修"},
	],
	[	
		{"item_code":"02","item_name":"车身维修"},
		{"item_code":"03","item_name":"电气系统维修"},
		{"item_code":"19","item_name":"发动机维修"},
		{"item_code":"14","item_name":"空调维修"},
		{"item_code":"07","item_name":"轮胎动平衡及修补"},
		{"item_code":"21","item_name":"喷油泵、喷油器维修"},
		{"item_code":"12","item_name":"气缸镗磨"},
		{"item_code":"17","item_name":"汽车玻璃安装及修复"},
		{"item_code":"18","item_name":"汽车美容装潢"},
		{"item_code":"20","item_name":"汽车润滑与养护"},
		{"item_code":"23","item_name":"汽车综合小修"},
		{"item_code":"11","item_name":"曲轴修磨"},
		{"item_code":"22","item_name":"散热器维修"},
		{"item_code":"08","item_name":"四轮定位检测调整"},
		{"item_code":"04","item_name":"自动变速器维修"},
		{"item_code":"99","item_name":"其它机动车维修"},
	]
]

export function setCategory(type) {
	let category = '';
	categoryJson.forEach(function(value) {
	  	if(value.item_code == type){
			category = value.item_name;
			return;				
		}
	});
	return category?category:'--';
}

export function setBusinessScope(index,arr) {
	let businessScope = [];
	if( index <= 4 ){
		arr.forEach(function(v,x){
			businessScopeJson[index-1].forEach(function(value,n) {
				if(value.item_code == v){
				  	businessScope.push(value.item_name);
				  	return;				
			  	}
			  	else{
			  		if(index == 3 && businessScopeJson[2].length-1 == n && x == arr.length-1){
			  			businessScope.push(v);
			  		}
			  	}
			  	
		  	});
		})
	}else{
		businessScope = arr; //其他的时候，例 arr = ["输入的内容"]
	}

	return businessScope?businessScope.join('、'):'';
}